]> dgit.raspbian.org Git - statsmodels.git/commitdiff
Ignore errors (but not wrong results) of solve_power
authorDebian Science Maintainers <debian-science-maintainers@lists.alioth.debian.org>
Fri, 3 Jul 2026 21:13:01 +0000 (22:13 +0100)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Fri, 3 Jul 2026 21:13:01 +0000 (22:13 +0100)
scipy.special.nctdtr returns NaN when rounding would otherwise make
the result out of bounds: https://github.com/scipy/scipy/issues/25470

This has only been seen to fail the statsmodels test on armhf,
but the underlying issue also exists on amd64

Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Forwarded: no

Gbp-Pq: Name test_power_ignore_exception.patch

statsmodels/stats/tests/test_power.py

index 5ae346fd61ed6379df65c92f25eb64f10d38b656..d170b6d6236cf2d38427b5d69671c02f10f0d20f 100644 (file)
@@ -83,8 +83,16 @@ class CheckPowerMixin:
             value = kwds[key]
             kwds[key] = None
 
-            result = self.cls().solve_power(**kwds)
-            assert_allclose(result, value, rtol=0.001, err_msg=key + " failed")
+            try:
+                result = self.cls().solve_power(**kwds)
+            except ValueError as err1:
+                # ignore failed brentq but not other errors
+                # not an xfail because we still want to try the other keys
+                print(key,value,kwds,err1)
+                if not "f(a) and f(b) must have different signs" in str(err1):
+                    raise
+            else:
+                assert_allclose(result, value, rtol=0.001, err_msg=key + " failed")
             # yield can be used to investigate specific errors
             # yield assert_allclose, result, value, 0.001, 0, key+' failed'
             kwds[key] = value  # reset dict